package com.self.liu.main;

import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

import com.self.liu.xp.thrift.service.ExecuteService;

public class ClientHelper {

    public static ExecuteService.Client createClient() {
        TTransport transport = new TSocket("10.144.25.142", 7777);
        try {
            transport.open();
        } catch (TTransportException e) {
            e.printStackTrace();
        }
        // 设置传输协议为 TCompactProtocol  
        TProtocol protocol = new TCompactProtocol(transport);
        return new ExecuteService.Client(protocol);
    }
}
